import { toSuccess, useEntityManager } from "@sker/core"
import { KsAccountFollow } from "@sker/entities"
import { useData } from "@sker/runtime"
import { z } from "zod"


export default async () => {
    const input = z.object({
        from: z.string(),
        to: z.string(),
    })
    const body = input.parse(useData())
    return await useEntityManager(async m => {
        const item = await m.findOne(KsAccountFollow, { where: { from: body.from, to: body.to } })
        if (item) return toSuccess(true)
        return toSuccess(false)
    })
}
